CC=/Developer/SDKs/iPhone/bin/arm-apple-darwin-cc
CPPFLAGS=-Wall
LD=$(CC)
LDFLAGS=-lobjc \
	-framework CoreFoundation \
	-framework Foundation \
	-framework UIKit \
	-framework LayerKit \
	-framework CoreGraphics \
	-framework GraphicsServices \
	-framework WebCore \
	-framework WebKit

OBJECTS=main.o CalculatorApp.o CalculatorEngine.o BasicKeypad.o
APP=IPHCalc
PHONE_IP=iphone
IMAGES=Default

all:	${APP}.app

install:
	scp -r "${APP}.app" root@${PHONE_IP}:/Applications

show:
	ssh root@${PHONE_IP} "ls -lR /Applications/${APP}.app"

run:
	ssh root@${PHONE_IP} "/Applications/${APP}.app/${APP}"

%.o: %.m
	$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@

${APP}: ${OBJECTS}
	$(LD) $(LDFLAGS) -o $@ $^

${APP}.app: ${APP}
	rm -rf "${APP}.app"
	mkdir -p "${APP}.app"
	cp ${APP} "${APP}.app"
	cp Info.plist "${APP}.app"
	cp images/${IMAGES}/*.png "${APP}.app"

clean:
	rm -rf *.o ${APP} ${APP}.app
	rm -rf build
